﻿using Beaker.Specs;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenCube.Model.Primitives;
using OpenCube.Model.Specs.Builders;

namespace OpenCube.Model.Specs
{
	[TestClass]
	public class GameTimeSpanSpecs
		: SpecsFor<GameTimeSpan, GameTimeSpanBuilder>
	{
		[TestMethod]
		public void NoonMapsTo6000GameTicks()
		{
			BuildSubject
				.WithTicks(6000);

			Subject.Days.Should().Be(0);
			Subject.Hours.Should().Be(12);
			Subject.Minutes.Should().Be(0);
			Subject.Seconds.Should().Be(0);
		}

		[TestMethod]
		public void ThereAre24000GameTicksInAGameDay()
		{
			BuildSubject
				.WithTicks(24000);

			Subject.TotalDays.Should().Be(1d);
			Subject.TotalHours.Should().Be(24);
			Subject.TotalMinutes.Should().Be(24 * 60);
			Subject.TotalSeconds.Should().Be(24 * 60 * 60);
		}

		[TestMethod]
		public void ToStringShouldFormatAsNiceTimeStringBasedOnInGameTime()
		{
			BuildSubject
				.WithTicks(6680);

			Subject.ToString().Should().Be("12:40:48");
		}
	}
}
